<template>
  <div id="edit">
    <div class="el_content">
      <el-row class="edit-title">
        <el-col :span="4">{{$route.query.name}}</el-col>
        <el-col :span="2" :push="18" class="text-right">
          <el-button
            class="back"
            type="info"
            size="mini"
            plain
            icon="el-icon-arrow-left"
            @click="goBack"
          >返回</el-button>
        </el-col>
      </el-row>
      <el-form :model="info" :rules="rules" ref="info" label-width="150px" class="el_t_20">
        <el-form-item label="实际诊疗日期：" prop="name">
          <el-row>
            <el-col :span="8">
              <el-date-picker class="el_long" v-model="info.date" type="date" placeholder="选择日期"></el-date-picker>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item
          :label="$route.query.name==='心理咨询'?'咨询内容：':$route.query.name==='心理治疗'?'治疗内容：':$route.query.name==='脑认知功能训练' && $route.query.name==='脑活动控制能力训练'?'训练内容：':$route.query.name==='健康课'?'课程能容：':'诊疗内容：'"
          prop="name"
          v-if="$route.query.name !== 'TMS' && $route.query.name !== 'L-TMS'"
        >
          <el-row>
            <el-col :span="24">
              <el-input type="textarea" v-model="info.remark" :rows="3" placeholder></el-input>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="备注：">
          <el-row>
            <el-col :span="24">
              <el-input type="textarea" v-model="info.remark" :rows="3" placeholder></el-input>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="诊疗医生：" prop="name">
          <el-radio-group v-model="info.radio">
            <el-radio :label="1">孙医生</el-radio>
            <el-radio :label="2">刘医生</el-radio>
            <el-radio :label="3">王医生</el-radio>
            <el-radio :label="4">其他</el-radio>
          </el-radio-group>
          <el-input type="text" class="input-more" placeholder="请输入医生姓名"></el-input>
        </el-form-item>
      </el-form>
      <el-row class="footer-fixed">
        <el-col :span="24" class="text-right">
          <el-button type="primary" plain>取 消</el-button>
          <el-button type="primary" @click="submitInfo('info')">保 存</el-button>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
export default {
  name: "edit",
  data() {
    return {
      info: {
        name: "",
        radio: 1,
        date: new Date(),
        remark:
          "该求助者的心理问题产生是由一次公开课发挥失常造成的，有明显的现实原因，而且有很好的自知力，也有求治愿望，从症状学来说，何某表现为焦虑、头疼、食欲下降、睡眠障碍等症状。"
      },
      rules: {
        name: [
          { required: true, message: "医嘱名称不能为空", trigger: "blur" }
        ],
        radio: [
          { required: true, message: "请选择所属分类", trigger: "change" }
        ]
      }
    };
  },
  methods: {
    submitInfo(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("验证通过！");
        } else {
          return false;
        }
      });
    },
    goBack() {
      this.$router.go(-1);
    }
  }
};
</script>
<style scoped>
.el_content {
  width: 100%;
  height: calc(100vh - 108px);
  background: #ffffff;
  padding: 20px;
}
.edit-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
  color: #006835;
  font-weight: 700;
}
</style>